package cardin

import (
	"context"
	"github.com/gogf/gf/v2/errors/gcode"
	"github.com/gogf/gf/v2/errors/gerror"
)

type CardActiveInp struct {
	CardCode string `json:"cardCode" v:"required#cardCode不能为空" dc:"卡片编码"`
}

func (in *CardActiveInp) Filter(ctx context.Context) (err error) {
	return
}

type CardActiveModel struct {
	CanUse bool `json:"canUse" description:"是否可用"`
}

type CardInfoInp struct {
	CardCode  string `json:"cardCode" dc:"卡片编码"`
	AccessKey string `json:"accessKey" dc:"激活账号"`
	SecretKey string `json:"secretKey" dc:"激活密码"`
}

func (in *CardInfoInp) Filter(ctx context.Context) (err error) {
	if (in.CardCode == "" && in.AccessKey == "" && in.SecretKey == "") ||
		(in.CardCode == "" && (in.AccessKey == "" || in.SecretKey == "")) {
		err = gerror.NewCode(gcode.CodeInvalidRequest, "参数错误")
		return
	}
	return
}

type CardInfoByQrCodeModel struct {
	CardCode         string `json:"cardCode" description:"卡片编码"`
	Available        bool   `json:"available" description:"是否可用"`
	Enable           bool   `json:"enable" description:"是否启用"`
	Expired          bool   `json:"expired" description:"是否过期"`
	IsActivate       bool   `json:"isActivate" description:"是否激活"`
	ExpireTime       string `json:"expireTime" description:"激活截止时间"`
	ActiveName       string `json:"activeName" description:"激活人昵称"`
	ActiveTime       string `json:"activeTime" description:"激活时间"`
	ActiveUserAvatar string `json:"activeUserAvatar" description:"激活人头像"`
	Phone            string `json:"phone" description:"手机号"`
}

type ActiveCardByQrCodeInp struct {
	CardCode string `json:"cardCode" v:"required#cardCode不能为空" dc:"卡片编码"`
}

type ActiveCardByQrCodeModel struct {
}
